/**
 * Created by MD-3 on 2017/8/2.
 */

var initmap_mock = {
    centerLng: 114.39599,
    centerLat: 30.492056,
    centerZoom: 15,
    unitName: '保护单位名称'
};

var config_mock = {
    ajaxInterval: 5000,
    themeColor: "#3f558e"
}

var resource_mock = {
    IMG_MARKER_TYPE0   : "/assets/map/img/zhongji.png",
    IMG_MARKER_TYPE1   : "/assets/map/img/zhongduan.png",
    IMG_MARKER_TYPE0_WARMING : "/assets/map/img/zhongji_warming.png",
    IMG_MARKER_TYPE1_WARMING : "/assets/map/img/zhongduan_warming.png",
    IMG_MARKER_ALARM   : "/assets/map/img/baojing.gif",
    IMG_MARKER_OFFLINE : "/assets/map/img/lixian.gif",
    IMG_MARKER_UPDATE  : "/assets/map/img/gengxin.gif",
    IMG_ALARM_OFF       : "/assets/map/img/ssjk_jinribaojing_shengyin.png",
    IMG_ALARM_ON        : "/assets/map/img/ssjk_jinribaojing_play.png",
    IMG_DEVICE_WS0      : "/assets/map/img/ssjk_shebeiguanli__zhengchang.png",
    IMG_DEVICE_WS1      : "/assets/map/img/ssjk_shebeiguanli__lixian.png",
    IMG_DEVICE_WS2      : "/assets/map/img/ssjk_shebeiguanli_baojing.png",
    IMG_DEVICE_Power    : "/assets/map/img/ssjk_shebeiguanli__dianliangbuzu.png"

}

var strokeColor_mock = {
    COLOR0: '#0000FF',
    COLOR1: '#FFA500',
    COLOR2: '#FF0000',
    COLOR3: '#008000',
    COLOR4: '#DA70D6',
    COLOR5: '#8B0000',
    COLOR6: '#00008B',
    COLOR7: '#800080',
    COLOR8: '#5F9EA0',
    COLOR9: '#FA8072'
}



// 配置 Mock 路径
require.config({
    paths: {
        mock: '/assets/map/mapjs/mock'
    }
});


//workState  工作状态：0-正常，1-离线
//alarmState 报警处理状态：0-无报警，1-有报警（未处理）

// 加载 Mock
require(['mock'], function(Mock) {
    Mock.mock(/mngwindow.json/, {
        "action": 1,                             // 是否成功
        "deviceList": [{
            id: '0001',
            type: '0',                          //0-中继，1-终端
            name: '中南民大',
            power: '10',                       //电量信息
            workState: '0',
            childDevList: [{
                id: '1001',
                type: '1',
                name: '16号教学楼',
                power: '100',
                workState: '0',
                alarmState: '0'
            }, {
                id: '1002',
                type: '1',
                name: '洪山高中',
                power: '10',
                workState: '0',
                alarmState: '1'
            }, {
                id: '1003',
                type: '1',
                name: '南湖大道',
                power: '10',
                workState: '0',
                alarmState: '0'
            }]
        },{
            id: '0002',
            type: '0',
            name: '武汉纺大',
            power: '100',
            workState: '0',
            childDevList: [{
                id: '2001',
                type: '1',
                name: '综合楼',
                power: '100',
                workState: '0',
                alarmState: '0'
            }, {
                id: '2002',
                type: '1',
                name: '小湖',
                power: '10',
                workState: '1',
                alarmState: '0'
            }, {
                id: '2003',
                type: '1',
                name: '操场',
                power: '100',
                workState: '0',
                alarmState: '1'
            }]
        }],
        "alarmList": [{                         //报警列表,要求数据顺序,未处理报警在前
            id: '1002',
            name: '洪山高中',
            alarmId: '001',
            alarmTime: '6/1 7:00',
            alarmState: '1',
            alarmType: '',
            audioUrl: "/assets/map/media/TheDawn.mp3",
        }, {
            id: '2003',
            name: '操场',
            alarmId: '002',
            alarmTime: '6/1 11:00',
            alarmState: '1',
            alarmType: '',
            audioUrl: "",
        }, {
            id: '2002',
            name: '小湖',
            alarmId: '003',
            alarmTime: '6/1 16:00',
            alarmState: '0',
            alarmType: '设备报警',
            audioUrl: "/assets/map/media/TheDawn.mp3",
        }, {
            id: '2002',
            name: '小湖',
            alarmId: '004',
            alarmTime: '6/1 17:00',
            alarmState: '0',
            alarmType: '监控报警',
            audioUrl: "",
        }, {
            id: '2002',
            name: '小湖',
            alarmId: '005',
            alarmTime: '6/1 18:00',
            alarmState: '0',
            alarmType: '设备报警',
            audioUrl: ""
        }]
    });

    Mock.mock(/infodata.json/, {
        "action": 1,
        "basicInfo": {
            id: '2002',
            productId         : '123456',
            productor         : '富士康',
            productVersion    : 'v1.1.2',
            productDate       : '2017-05-16',
            installer         : 'zhangsan',
            installTime       : '2017-05-22',
            installPosition   : '小湖',
            installPreDevice  : '武汉纺大'
        },
        "alarmInfoList": [{
            id: '2002',
            name: '小湖',
            alarmId: '008',
            alarmTime: "2017-05-27 11:22",
            alarmState: '0',
            alarmType: '',
            audioUrl: "/assets/map/media/TheDawn.mp3"
        },{
            id: '2002',
            name: '小湖',
            alarmId: '007',
            alarmTime: "2017-05-27 16:22",
            alarmState: '1',
            alarmType: '监控报警',
            audioUrl: ""
        }],
        "deviceconfig": {
            configMode: '白天模式',
            modeList:['白天模式','夜晚模式'],
            lastAlarmTime: '2017-05-28 15:00:00',
            lastUploadTime: '2017-05-22 01:00:00'
        },
        "devicestate": {
            workState: '0',
            netType: '4G',
            netState: '连接良好',
            power: '80'
        }
    });

    Mock.mock(/checkAlarm.json/, {
        "action": 1,                             // 是否成功
        "checkdevice": {
            id: '2002',
            name: '小湖',
            alarmId: '007',
            alarmState: '0',
            workState : '0'
        }
    });
    Mock.mock(/defendtoggle.json/, {
        "action": 1,                             // 是否成功
        "togdevice": {
            id: '2002',
            name: '小湖',
            togState: 1                        //0-设备布防，1-设备撤防
        }
    });
    Mock.mock(/shieldtoggle.json/, {
        "action": 1,                             // 是否成功
        "togdevice": {
            id: '2002',
            name: '小湖',
            togState: 1                        //0-取消屏蔽，1-屏蔽设备
        }
    });

    Mock.mock(/listenertoggle.json/, {
        "action": 1,                             // 是否成功
        "toglistener": {
            id: '2002',
            name: '小湖',
            audioUrl: "/assets/map/media/TheDawn.mp3"
        }
    });


});


/*
 workState:     0-正常，  1-离线
 alarmState:    0-无报警，1-有报警（报警未处理）
 */
var deviceList_mock = [{
    id: '0001',
    type: '0',                     //0-中继，1-终端
    name: '中南民大',
    position: {lng: '114.391484', lat: '30.48756'},
    workState: '0',
    childDevList: [{
        id: '1001',
        type: '1',
        name: '16号教学楼',
        position: {lng: '114.39569', lat: '30.492775'},
        radius: 300,
        workState: '0',
        alarmState: '0',
        alarmlist:[{
            alarmId: '',
            alarmTime: '',
        }]
    }, {
        id: '1002',
        type: '1',
        name: '洪山高中',
        position: {lng: '114.387676', lat: '30.489973'},
        radius: 200,
        workState: '0',
        alarmState: '1',
        alarmlist:[{
            alarmId: '001',
            alarmTime: '6/1 7:00',
        }]
    }, {
        id: '1003',
        type: '1',
        name: '南湖大道',
        position: {lng: '114.384242', lat: '30.479211'},
        radius: 500,
        workState: '1',
        alarmState: '0',
        alarmlist:[{
            alarmId: '',
            alarmTime: '',
        }]
    }]
},
    {
        id: '0002',
        type: '0',
        name: '武汉纺大',
        position: {lng: '114.398651', lat: '30.485915'},
        workState: '0',
        childDevList: [{
            id: '2001',
            type: '1',
            name: '综合楼',
            position: {lng: '114.397095', lat: '30.48622'},
            radius: 100,
            workState: '0',
            alarmState: '0',
            alarmlist:[{
                alarmId: '',
                alarmTime: '',
            }]
        }, {
            id: '2002',
            type: '1',
            name: '小湖',
            position: {lng: '114.396698', lat: '30.484639'},
            radius: 100,
            workState: '0',
            alarmState: '1',
            alarmlist:[{
                alarmId: '003',
                alarmTime: '6/1 16:00',
            },{
                alarmId: '004',
                alarmTime: '6/1 17:00',
            },{
                alarmId: '005',
                alarmTime: '6/1 18:00',
            }]
        }, {
            id: '2003',
            type: '1',
            name: '操场',
            position: {lng: '114.400904', lat: '30.486146'},
            radius: 100,
            workState: '0',
            alarmState: '1',
            alarmlist:[{
                alarmId: '002',
                alarmTime: '6/1 11:00',
            }]
        }]
    }
];

//模拟报警
var alarmList_mock = [{
    id: '2002',
    name: '小湖',
    alarmId: '008',
    alarmTime: "2017-05-27 11:22",
    alarmState: '1',
    alarmType: '',
    audioUrl: "/assets/map/media/TheDawn.mp3"
}];

